<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>利用类选择器画三个盒子</title>
  <style>
    .red {
      width: 100px;
      height: 100px;
      /* 背景颜色 */
      background-color: red;
    }

    .green {
      width: 100px;
      height: 100px;
      background-color: green;
    }
  </style>
</head>

<body>
  <div class="red">红色</div>
  <div class="green">绿色</div>
  <div class="red">红色</div>
</body>

</html>